<?php 
/*
 * Modelo para el Documentento de Tesis (Tesis de pregrado)
 */
class MasterThesis extends Doctrine_Record {
		
	public function setTableDefinition() {
		$this->hasColumn('tutors', 'string', 255,
    	array(
				'notnull' => true,
    		'comment' => 'Nombre de los tutores'
      )
    );
    
    $this->hasColumn('department', 'string', 50,
    	array(
    		'comment' => 'Nombre del departamento al que pertenece'
      )
    );
    
    $this->hasColumn('faculty', 'string', 50,
    	array(
    		'comment' => 'Nombre del departamento al que pertenece'
      )
    );
    
    $this->hasColumn('knowledgeArea', 'string', 50,
    	array(
    		'comment' => 'Area del conocimiento'
      )
    );
    
    $this->hasColumn('document_id', 'integer', 4,
    	array(
    		'notnull' => true,
    		'comment' => 'id del documento asociado a este tipo.'
      )
    );
    
	}
	
	public function setUp() {
		$this->hasOne('Document as document', 
			array(
				'local' => 'document_id',
				'foreign' => 'id',
				'onDelete' => 'CASCADE'
			)
		);
	}
	
/**
	 * 
	 * @param unknown_type $data
	 * @return unknown_type
	 */
	public function updateValues($data) {
		if( isset($data['tutors']) ) {
			$this->tutors = $data['tutors'];
		}
		if( isset($data['department']) ) {
			$this->department = $data['department'];
		}
		if( isset($data['faculty']) ) {
			$this->faculty = $data['faculty'];
		}
		if( isset($data['knowledgeArea']) ) {
			$this->knowledgeArea = $data['knowledgeArea'];
		}
	}

}
